package command;

public class RemonteController {

    Command [] onCommands;
    Command [] offCommands;
    Command undoCommand;


    public RemonteController() {

        onCommands = new Command[5];
        offCommands = new Command[5];

        for (int i = 0; i < 5; i++) {
            onCommands[i] = new NoCommand();
            offCommands[i] = new NoCommand();
        }

    }

    public void setCommond(int no,Command onCommond,Command offCommond){
        onCommands[no] = onCommond;
        offCommands[no] = offCommond;
    }


    public void onButtonWasPushed(int no){
        onCommands[no].execute();
        undoCommand = onCommands[no];
    }
    public void offButtonWasPushed(int no){
        offCommands[no].execute();
        undoCommand = offCommands[no];
    }
    public void undoButtonWasPushed(int no){
        undoCommand.undo();
    }
}
